import {Map} from 'immutable'
import * as actionTypes from './constants'
const defaultState = Map({
  currentCat: '全部',
  currentOrder:'hot',
  playlist: [],
  currentPage: 1,
  totalCount: 0,
  catList: [],
  playlistDetail: {},
  commentList: [],
  currentCommentPage: 1,
  totalCommentCount: 0,
  lovePeoples:[]
})
export default function reducer(state = defaultState, action) {
  switch (action.type) {
    case actionTypes.CHANGE_CURRENT_CAT_ACTION:
      return state.set('currentCat', action.currentCat)
    case actionTypes.CHANGE_PLAYLIST_ACTION:
      return state.set('playlist', action.playlist)
    case actionTypes.CHANGE_PLAYLIST_TOTAL_COUNT_ACTION:
      return state.set('totalCount', action.totalCount)
    case actionTypes.CHANGE_CURRENT_PAGE_ACTION:
      return state.set('currentPage', action.currentPage)
    case actionTypes.CHANGE_PLAYLIST_CAT_ACTION:
      return state.set('catList', action.catList)
    case actionTypes.CHANGE_PLAYLIST_DETAIL_ACTION:
      return state.set('playlistDetail', action.playlistDetail)
    case actionTypes.CHANGE_PLAYLIST_COMMENT_ACTION:
      return state.set('commentList', action.commentList)
    case actionTypes.CHANGE_CURRENT_COMMENT_PAGE_ACTION:
      return state.set('currentCommentPage', action.currentCommentPage)
    case actionTypes.CHANGE_COMMENT_COUNT_ACTION:
      return state.set('totalCommentCount', action.totalCommentCount)
    case actionTypes.CHANGE_LOVE_PEOPLE_ACTION:
      return state.set('lovePeoples',action.lovePeoples)
    default:
      return state
  }
}